﻿@page "/Error"

@using System.Diagnostics

<PageTitle>Error</PageTitle>

<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

@if (showRequestId)
{
    <p>
        <strong>Request ID:</strong> <code>@requestId</code>
    </p>
}

@code {
    private string? requestId;
    private bool showRequestId => !string.IsNullOrEmpty(requestId);

    [CascadingParameter]
    public HttpContext? HttpContext { get; set; }

    protected override void OnInitialized()
    {
        requestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
    }
}
